<?php
namespace Mobile\Model;
use Think\Model;
class OrderModel extends Model
{
    public function getAll($id){
        $list=$this->field('u.name uname,m.name mname,m.language mlang,m.release_at mtime,s.showtime stime,o.id oid,o.quantity onum,o.screening_id osid')
            ->table('pre_user u,pre_movie m,pre_order o,pre_screening s')
            ->where("u.id = o.user_id and m.id = o.movie_id and s.id = o.screening_id and member_id=$id")
            ->order("o.created_at")
            ->select();
        return $list;
    }

    public function setAll($id){
        $res=$this->field('
                       m.name mname,
                       m.language mlang,
                       r.name rname,
                       s.showtime stime,
                       o.price oprice,
                       oi.seat_row oir,
                       oi.seat_column oic
                       ')
            ->table('pre_movie m,pre_screening s,pre_order o,pre_order_item oi,pre_room r')
            ->where("m.id=o.movie_id and s.id=o.screening_id
             and s.id=oi.screening_id and r.id=s.room_id and oi.order_id=$id")->find();
        return $res;
    }
}

